package com.Imp;
import com.entity.User;
import com.mapper.UserMapper;
import com.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.io.IOException;

public class UserMapperImpl implements UserMapper {
    public User getUserByUsername(String userName){
        SqlSession sqlSession = MyBatisUtil.openSqlSession();
        User u = sqlSession.selectOne("com.mapper.UserMapper.getUserByUsername", userName);
        return u;
    }
    public void insertUser(User user){
        SqlSession sqlSession = MyBatisUtil.openSqlSession();
        sqlSession.insert("com.mapper.UserMapper.insertUser", user);
        sqlSession.commit();
    }
}
